package nl.utwente.eemcs.graph;

import java.util.ArrayList;
import java.util.List;

/**
 * A branched construct is either a conditional or a flow construct
 * @author Evert Duipmans
 */
public abstract class BranchedConstruct<T1 extends Node, T2 extends Node> extends CompositeNode<T1, T2> {
	/**
	 * List with the branches
	 */
	protected List<Graph> branches = new ArrayList<Graph>();
	
	/**
	 * Start node of the branched construct
	 */
	protected T1 startNode;
	
	/**
	 * End node of the branched construct
	 */	
	protected T2 endNode;

	/**
	 * Create a new branched construct, with a name
	 * @param name Name of the construct
	 */
	public BranchedConstruct(String name) {
		super(name);
	}
	
	/**
	 * Create a new branched construct, with a name
	 * @param name Name of the construct
	 */
	public BranchedConstruct(String name, T1 startNode, T2 endNode) {
		this(name);
		this.startNode = startNode;
		this.endNode = endNode;
	}	
	
	/**
	 * Get all the branches
	 * @return The branches
	 */
	public List<Graph> getBranches() {
		return this.branches;
	}
	
	public T1 getStartNode() {
		return startNode;
	}

	public void setStartNode(T1 startNode) {
		this.startNode = startNode;
	}

	public T2 getEndNode() {
		return endNode;
	}

	public void setEndNode(T2 endNode) {
		this.endNode = endNode;
	}	
}
